package cn.hj.domain.strategy.adapter.repository;

import cn.hj.domain.strategy.model.entity.StrategyAwardEntity;
import cn.hj.domain.strategy.model.entity.StrategyEntity;
import cn.hj.domain.strategy.model.entity.StrategyRuleEntity;
import cn.hj.domain.strategy.model.valobj.RuleTreeVO;
import cn.hj.domain.strategy.model.valobj.RuleWeightVO;
import cn.hj.domain.strategy.model.valobj.StrategyAwardRuleModelVO;
import cn.hj.domain.strategy.model.valobj.StrategyAwardStockKeyVO;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 策略仓储接口
 */
public interface IStrategyRepository {

    List<StrategyAwardEntity> queryStrategyAwardList(long strategyId);

    void storeStrategyAwardSearchRateTables(String key, BigDecimal rateRange, HashMap<Integer, Integer> shuffleStrategyAwardSearchRateTables);

    int getRange(Long strategyId);

    int getRange(String key);

    Integer getStrategyAwardAssemble(String key, int i);

    StrategyEntity queryStrategyEntityByStrategyId(long strategyId);

    StrategyRuleEntity queryStrategyRuleByStrategyId(long strategyId, String ruleWeight);

    String queryStrategyRuleValue(Long strategyId, Long awardId, String ruleModel);

    StrategyAwardRuleModelVO queryStrategyAwardRuleModelVO(Long strategyId, Integer awardId);

    String queryStrategyRuleValue(Long strategyId, String ruleModels);

    RuleTreeVO queryRuleTreeVOByTreeId(String treeId);

    void cacheStrategyAwardCount(String cacheKey, Integer awardCount);

    Boolean subtractionAwardStock(String cacheKey, Date date);

    Boolean subtractionAwardStock(String cacheKey);

    void awardStockConsumerSendQueue(StrategyAwardStockKeyVO strategyAwardStockKeyVO);

    StrategyAwardStockKeyVO getQueueValue();

    void updateStock(Long strategyId, Integer awardId);

    StrategyAwardEntity queryStrategyAwardEntity(Long strategyId, Integer awardId);

    long queryStrategyIdByActivityId(long activityId);

    Integer queryTodayUserRaffleCount(Long strategyId, String userId);

    Map<String, Integer> queryAwardRuleLockCount(String[] treeIds);

    int queryActivityAccountTotalUseCount(String userId, Long strategyId);

    List<RuleWeightVO> queryAwardRuleWeight(Long strategyId);


    void awardStockConsumeSendQueue(StrategyAwardStockKeyVO build);
}
